package com.qingcloud.fexecutor.base.enums;

public enum BaseAppFromEnum {

    APPLICATION(1, "应用可见"),
    SYSTEM(2, "组织可见"),
    DATABASE(3, "商城可见");

    public final Integer code;
    public final String name;

    BaseAppFromEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static BaseAppFromEnum findByName(String name) {
        for (BaseAppFromEnum type : BaseAppFromEnum.values()) {
            if (type.name().equalsIgnoreCase(name)) {
                return type;
            }
        }
        return null;
    }

    public static String getNameByCode(Integer code) {
        for (BaseAppFromEnum type : BaseAppFromEnum.values()) {
            if (code.equals(type.code)) {
                return type.name;
            }
        }
        return "";
    }
}
